package com.auxgroup.smarthome.dto;

import com.auxgroup.smarthome.entity.RoleEntity;
import com.auxgroup.smarthome.entity.MenuEntity;
import org.hibernate.validator.constraints.NotEmpty;

import java.util.List;
import java.util.Set;

/**
 * Created by kevinchen on 2017/2/22.
 */
public class RoleDto {

    @NotEmpty(message = "角色名称不能为空")
    private String roleName;

    private String roleDescription;

    private List<String> menuIds;

    public RoleDto() {
    }

    public RoleDto(String roleId, String roleName, String roleDescription, List<String> menuIds) {
        this.roleName = roleName;
        this.roleDescription = roleDescription;
        this.menuIds = menuIds;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getRoleDescription() {
        return roleDescription;
    }

    public void setRoleDescription(String roleDescription) {
        this.roleDescription = roleDescription;
    }

    public List<String> getMenuIds() {
        return menuIds;
    }

    public void setMenuIds(List<String> menuIds) {
        this.menuIds = menuIds;
    }

    public RoleEntity createRoleEntity(RoleEntity roleEntity, Set<MenuEntity> menus){
        if (roleEntity==null)return null;
        roleEntity.setRoleName(this.roleName);
        roleEntity.setRoleDescription(this.roleDescription);
        roleEntity.setMenus(menus);
        return roleEntity;
    }

}
